import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.*;

/**
 * @program: junit5_learning
 * @description: 控制
 * @author: CaoYong
 * @create: 2021-03-11 19:06
 **/
public class Condition {

    @Test
    @EnabledOnJre(JRE.JAVA_8)
    void JavaRuntimeConditions() {
        System.out.println("JAVA 8");
    }

    @Test
    @DisabledOnJre(JRE.JAVA_8)
    void notOnJava8() {
        System.out.println("It will not run on Java8");
    }

    @Test
    @EnabledOnOs(OS.LINUX)
    void operatingSystemConditions() {
        System.out.println("Running under Linux");
    }

    @Test
    @EnabledIfSystemProperty(named = "os.arch", matches = ".*64.*")
    void systemPropertyConditions() {
        System.out.println("Running on a 64 bit system");
        System.out.println(System.getProperties());
    }

    @Test
    @EnabledIfEnvironmentVariable(named = "USER", matches = "shiyanlou")
    void environmentVariableConditions() {
        System.out.println(System.getenv());
    }
}
